#
# AI Events
#
#   written by 
#		Celedhring 
#		Henrik Fhraeus
#		Johan Andersson
#
#

############################################################################################
#GERMANY
############################################################################################

#GERMANY PREPARES INVASION OF BRITAIN#

event = {
	id = 10001
	random = no
	country = GER
	
	trigger = {
	      	ai = yes     
		war = { country = GER country = ENG }
	      	control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		NOT = {
			war = { country = GER country = SOV }
		}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1936 }
	offset = 15 # Check for trigger conditions every 15 days
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
				command = { type = ai which = "core_germany_bob.ai" }
	}
}
		

#GERMANY SWITCHES TO BARBAROSSA BUILDUP - UK STILL UNDEFEATED#

event = {
	id = 10002
	random = no 
	country = GER
	
	trigger = {
		random = 10 # # Germany should not automatically switch strategy at this point 
		war = { country = GER country = ENG}
		ai = yes
		control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		exists = SOV
	}

	name = "AI_EVENT"
	desc = ""
	style = 0	
	
	date = { day = 1 month = september year = 1940 }
	offset = 15 # Check for trigger conditions every 15 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_germany_barbarossa.ai" }
	}

}

#GERMANY SWITCHES TO BARBAROSSA BUILDUP - AUTOMATIC EVENT IN CASE UK IS DEFEATED OR WAR WITH USSR STARTS#

event = {
	id = 10003
	random = no 
	country = GER

	trigger = {
		ai = yes
		control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		OR = {
			war = {country = GER country = SOV}
			NOT = {
				war = {country = GER country = ENG}
			}
		}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 15 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_germany_barbarossa.ai" }
	}
}	

#  Switch to Sealion AI preferences if bitter peace.

event = {
	id = 10004
	random = no
	country = GER

	trigger = {
		ai = yes
		OR = {
			event = 5308 # USSR - The Bitter Peace
			event = 5309 # USSR - The Bitter Peace
			NOT = {
				exists = SOV
			}
		}
	}
	
	name = "AI_EVENT"
	style = 0
	
	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 15 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		name = "OK"
		command = { type = ai which = "core_germany_sealion.ai" }
	}
}


#GERMANY TURNS TO DEFENCE#

event = {
	id = 10005
	random = no
	country = GER

	trigger = {
		ai = yes
		war = { country = USA country = GER } # The mighty US has entered the war
		#If Germany has still a comfortable position on the continent, then nopes
		NOT = {
			control = { province = 527 data = GER } # Germany controls Paris 
		}
		NOT = {
			control = { province = 643 data = GER } # Germany controls Warszawa
		}

	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 15 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_germany_defense.ai" }
	}
}

##########################################################################################
#ITALY
##########################################################################################

#ITALY RUNS TO DEFENCE#

event = {
	id = 10006
	random = no
	country = ITA

	trigger = {
		ai = yes
		# Allies are in any province in mainland Italy
		NOT = {
			control = { province = 900 data = ITA } 
			control = { province = 901 data = ITA } 
			control = { province = 902 data = ITA } 
			control = { province = 903 data = ITA }
			control = { province = 905 data = ITA }
			control = { province = 906 data = ITA }
			control = { province = 907 data = ITA }
			control = { province = 908 data = ITA }
			control = { province = 910 data = ITA }
			control = { province = 912 data = ITA }
			control = { province = 914 data = ITA }
			control = { province = 915 data = ITA }
		}
		# And North Africa is lost. Put this here so a 1 division invasion doesn't start panic all over Italy
		NOT = {
			control = { province = 1085 data = ITA } # Tripoli
			control = { province = 1097 data = ITA } # Tobruk
		}
	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_defensive.ai" }
	}
}	


############################################################################################
#FRANCE
############################################################################################


#20% chance for france to go static defence.. :)
event = {
	id = 10008
	random = no
	country = FRA

	trigger = {
		ai = yes
		random = 20 # Only happens one time in five
	}
	
	name = "AI_EVENT"
	desc = "AI_EVENT"
	style = 0
	
	date = { day = 1 month = january year = 1936 }

	action_a = {
		name = "OK"
		command = { type = ai which = "core_France_static.ai" }
	}
}

#GERMANY ATTACKS#
###############
#OBSOLETE
###############
#event = {
#	id = 10009
#	random = no
#	country = FRA
#
#	trigger = {
#		ai = yes
#		war = { country = FRA country = GER }
#	}
#
#	name ="AI_EVENT"
#	desc =""
#	style = 0
#
#	date = { day = 1 month = january year = 1936 }
#	offset = 5 # Check for trigger conditions every 3 days
#	deathdate = { day = 30 month = december year = 1947 }
#
#	action_a = {
#				command = { type = ai which = "core_defensive.ai" }
#	}
#}				

#FREE FRENCH AI#

event = {
	id = 10010
	random = no
	country = FRA

	trigger = { 
		ai = yes
		exists = VIC
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_free_french.ai" }
	}
}		

#LIBERATION OF FRANCE#

event = {
	id = 10011
	random = no
	country = FRA

	trigger = {
		ai = yes
		event = 2802 # Liberation of France event
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_France.ai" }
	}
}	
		

############################################################################################
#USSR
############################################################################################

#RUSSIAN HORDES#
#
#event = {
#	id = 10012
#	random = no
#	country = SOV
#
#	trigger = {
#		ai = yes
#		war = { country = SOV country = GER }
#	# Smolensk and Kiev are lost. Made this to avoid USSR going defensive if she declares war on Germany early on
#		NOT = {
#			control = { province = 781 data = SOV } 	
#			control = { province = 775 data = SOV }
#		}
#	}
#	
#	name ="AI_EVENT"
#	desc =""
#	style = 0
#
#	date = { day = 1 month = january year = 1936 }
#	offset = 15 # Check for trigger conditions every 15 days
#	deathdate = { day = 30 month = december year = 1947 }
#
#	action_a = {
#				command = { type = ai which = "USSR_defense.ai" }
#	}
#}								

#THE TIDE TURNS - USSR GOES OFFENSIVE IF ABLE TO PUSH GERMANS BACK#
# DELETED FOR TESTING
#event = {
#	id = 10013
#	random = no
#	country = SOV
#
#	trigger = {
#		ai = yes
#		war = { country = SOV country = GER }
#		event = 10012 #USSR was being defensive
#	# Kiev or Smolensk are in Russian control
#		OR = {
#			control = { province = 781 data = SOV }
#			control = { province = 775 data = SOV }
#		}
#	# Germany has a second front
#		OR = {
#			war = { country = GER country = ENG }
#			war = { country = GER country = USA }
#		}
#	}
#
#	name ="AI_EVENT"
#	desc =""
#	style = 0
#
#	date = { day = 1 month = january year = 1936 }
#	offset = 3 # Check for trigger conditions every 3 days
#	deathdate = { day = 30 month = december year = 1947 }
#
#	action_a = {
#				command = { type = ai which = "core_USSR.ai" }
#	}
#}	

#############################################################################################################################
#UK
#############################################################################################################################

#THE TIDE TURNS - UK GOES OFFENSIVE#

event = {
	id = 10014
	random = no
	country = ENG

	trigger = {
		ai = yes
		war = { country = ENG country = GER }
		war = { country = GER country = SOV }
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_UK_Rebound.ai" }
	}
}	



#############################################################################################################################
#USA
############################################################################################################################# id 10015 DELETED
#
#THE TIDE TURNS - USA GOES OFFENSIVE#
#

##########################################################################
#  US-UK Convoy (Oil, Supplies)
 #########################################################################
event = {
	id = 2116
	random = no
	country = USA

	trigger = {
		ai = yes
		war = { country = USA country = GER }
		war = { country = GER country = ENG }
	}
	
	name = "AI_Event"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1939 }
	offset = 15 # Check for trigger conditions every 5 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = convoy which = 125 value = 489 when = 17 } # Boston to Manchester
	}
}

#########################################################################
#  Canada-UK Convoy (Steel, Supplies)
#########################################################################

event = {
	id = 2117
	random = no
	country = CAN

	trigger = {
		ai = yes
		atwar = yes
		atwar = ENG
	}
	
	name = "AI_Event"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1939 }
	offset = 15 # Check for trigger conditions every 5 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = convoy which = 153 value = 489 when = 18 } #Halifax to Manchester
	}
}



################################################
#NatChi joins the Allies when JAP had dow'ed USA
################################################

event = {
 id = 2158
 random = no
 trigger = {
	ai = yes
	exists = ENG
	war = { country = JAP country = CHI } #Japan has DOW'ed China
	war = { country = JAP country = USA } #Japan has DOW'ed USA
	alliance = { country = JAP country = GER } #Japan has gone Axis
	NOT = {
		alliance = { country = CHI country = USA } #If UK is already annexed
		alliance = { country = CHI country = ENG } #China shouldn't be Allied yet
		alliance = { country = CHI country = GER } #China shouldn't be Axis either
		alliance = { country = CHI country = SOV } #China shouldn't be Comintern
		alliance = { country = GER country = ENG } #England shouldn't have left the Allies
	      }
	}
 country = CHI
 date = { day = 2 month = january year = 1937 }
 offset = 15
 deathdate = { day = 30 month = december year = 1947 }
 name = "China joins Allies!"
 desc = "China joins Allies!"
 style = 0
 action_a = {
	name = "Ok"
	command = { type = alliance which = ENG }
	command = { type = alignment which = democratic value = 100 }
	command = { type = dissent value = -10 }
	    }
	}



#######id 5037 also used!!!!!!


###########################################################################
###Netherlands move capital to the Dutch East Indies when nearly conquered
###########################################################################

event = {
	id = 5036
	random = no
	country = HOL
	
                trigger = { 
                ai = yes 
                OR = {    
                           control = { province = 561 data = GER }  
                           control = { province = 590 data = GER }  
                           control = { province = 550 data = GER }  
                           control = { province = 551 data = GER }  
                           }
        }

	name = "Dutch capital moves to Surabaya"
	desc = "Dutch capital moves to Surabaya"
        style = 0

	date = { day = 1 month = january year = 1939 }
	offset = 3
	deathdate = { day = 1 month = december year = 1941 }

	action_a = {
		name = "Ok"
                command = { type = capital which = 1950 } # surabaya
                }
	}


################################################################
###Belgium moves its capital to the Kongo when nearly conquered
################################################################

event = {
	id = 5040
	random = no
	country = BEL
	
                trigger = { 
                ai = yes 
		OR = {
		control = { province = 548 data = GER }  
		control = { province = 552 data = GER }  
		control = { province = 557 data = GER }  
                }                             
                       }

	name = "Belgian capital moves to Leopoldville!"
	desc = "Belgian capital moves to Leopoldville!"
        style = 0

	date = { day = 1 month = january year = 1939 }
	offset = 3
	deathdate = { day = 1 month = december year = 1946 }

	action_a = {
		name = "Ok"
                command = { type = capital which = 1130 } # Leopoldville
             }
	}